'use strict';

const Sequelize = require('sequelize');
const sequelize = require('../plugins/db');

const Model = Sequelize.Model;
class Tag extends Model {}

// 静态属性：主键字段名称
Tag.pk = 'tid';
Tag.init({
    tid: {
      type: Sequelize.INTEGER,
      autoIncrement: true,
      primaryKey: true,
      comment: '标签id'
    },
    name: {
      type:  Sequelize.STRING,
      allowNull: false,
      comment: '标签名'
    },
    alias: {
      type: Sequelize.STRING,
      comment: '别称'
    },
    count: {
      type: Sequelize.INTEGER,
      defaultValue: 0,
      comment: '数量'
    }
}, {
    sequelize,
    tableName: 'tag',
    freezeTableName: true,
    timestamps: true
});
module.exports = Tag;
